package HLSubScreen;

import HLLib.base.HLInputManager;
import HLLib.base.HLInputManager_H;
import HLLib.base.HLPoint;
import HLLib.base.HLRectangle;
import HLLib.map.HLLocation;
import HLLib.map.HLMKMap;

public class MapTest implements HLInputManager_H {
    HLMKMap map;

    int latitude = 4007430;

    int longitude = 11631509;

    int zoom = 1000;

    public int oldX;

    public int oldY;

    public MapTest() {

        map = new HLMKMap();
        HLLocation newLocation = new HLLocation(latitude, longitude);
        map.InitByRectAndCenterAndZoom(0, 0, 320, 480, newLocation.latitude, newLocation.longitude, zoom);
        HLPoint poitn = map.GetPoint(newLocation.latitude, newLocation.longitude);
        System.out.println();
    }

    public void Logic() {
        if (HLInputManager.IsInputDown(GAME_POINTER)) {

            if (HLInputManager.PointDownInRect(0, 480 - 32, 160, 32)) {
                zoom = zoom + 500;
                // map.InitByRectAndCenterAndZoom(0, 10, 240, 320, latitude ,
                // longitude , zoom);
                map.SetZoom(zoom);
            } else if (HLInputManager.PointDownInRect(160, 480 - 32, 320, 32)) {
                zoom = zoom - 500;
                map.SetZoom(zoom);
                // map.InitByRectAndCenterAndZoom(0, 0, 320, 480, latitude ,
                // longitude , zoom);
            } else {

                oldX = HLInputManager.pointerX;
                oldY = HLInputManager.pointerY;
            }

        }
        if (HLInputManager.IsInputUp(GAME_POINTER) && HLRectangle.IsRectContainsPoint(0, 0, 240, 280, HLInputManager.pointerX, HLInputManager.pointerY)) {

            map.SetMove(HLInputManager.pointerX - oldX, HLInputManager.pointerY - oldY);
        }
    }

}
